package com.ruoyi.web.ydz.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.web.ydz.domain.ProtocolPolicy;
import com.ruoyi.web.ydz.mapper.ProtocolPolicyMapper;
import com.ruoyi.web.ydz.service.IProtocolPolicyService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 协议配置Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-01-16
 */
@Service
public class ProtocolPolicyServiceImpl implements IProtocolPolicyService
{
    @Resource
    private ProtocolPolicyMapper protocolPolicyMapper;

    /**
     * 查询协议配置
     * 
     * @param id 协议配置主键
     * @return 协议配置
     */
    @Override
    public ProtocolPolicy selectProtocolPolicyById(Long id)
    {
        return protocolPolicyMapper.selectProtocolPolicyById(id);
    }

    /**
     * 查询协议配置列表
     * 
     * @param protocolPolicy 协议配置
     * @return 协议配置
     */
    @Override
    public List<ProtocolPolicy> selectProtocolPolicyList(ProtocolPolicy protocolPolicy)
    {
        return protocolPolicyMapper.selectProtocolPolicyList(protocolPolicy);
    }

    /**
     * 新增协议配置
     * 
     * @param protocolPolicy 协议配置
     * @return 结果
     */
    @Override
    public int insertProtocolPolicy(ProtocolPolicy protocolPolicy)
    {
        protocolPolicy.setCreateTime(DateUtils.getNowDate());
        return protocolPolicyMapper.insertProtocolPolicy(protocolPolicy);
    }

    /**
     * 修改协议配置
     * 
     * @param protocolPolicy 协议配置
     * @return 结果
     */
    @Override
    public int updateProtocolPolicy(ProtocolPolicy protocolPolicy)
    {
        protocolPolicy.setUpdateTime(DateUtils.getNowDate());
        return protocolPolicyMapper.updateProtocolPolicy(protocolPolicy);
    }

    /**
     * 批量删除协议配置
     * 
     * @param ids 需要删除的协议配置主键
     * @return 结果
     */
    @Override
    public int deleteProtocolPolicyByIds(Long[] ids)
    {
        return protocolPolicyMapper.deleteProtocolPolicyByIds(ids);
    }

    /**
     * 删除协议配置信息
     * 
     * @param id 协议配置主键
     * @return 结果
     */
    @Override
    public int deleteProtocolPolicyById(Long id)
    {
        return protocolPolicyMapper.deleteProtocolPolicyById(id);
    }
}
